<script setup name="TabBar">
import {ref} from 'vue'
const active = ref(0)
const tabList = ref([
  {
    name: '首页',
    icon: 'home',
    pagePath: '/pages/home/home'
  },
  {
    name: '订单',
    icon: 'order',
    pagePath: '/pages/order/order'
  }
])
function handleClick(index,tab) {
  active.value = index
  uni.switchTab({
    url: tab.pagePath
  })
}
</script>

<template>
  <up-tabbar
      :value="active"
      fixed
      placeholder
      safeAreaInsetBottom
  >
    <up-tabbar-item
        v-for="(tab,index) in tabList"
        :text="tab.name"
        :icon="tab.icon"
        :key="index"
        @click="handleClick(index,tab)"
    />
  </up-tabbar>
</template>

<style scoped lang="scss">

</style>